#include "stdafx.h"
#include "worldScene.h"
#include "UIMain.h"
#include "RightWnd.h"
#include "InspectorWnd.h"

void CWorldScene::processMsg(mini::event& msg)
{
	if (mini::MSG_TYPE::LEFTUP == msg.Messtype)
	{
		auto pPickEntity = calculationPickEntity((float)msg.point.x, (float)msg.point.y);
		auto pWnd = mini::ui::CUIMain::pMySelf->findWnd("RightWnd");
		CRightWnd* pRightWnd = dynamic_cast<CRightWnd*>(pWnd);
		CInspectorWnd* pInspectorWnd = pRightWnd->getInspectorWnd();
		pInspectorWnd->setPickActor(dynamic_cast<mini::CActor*>(pPickEntity));
	}
	else if (mini::MSG_TYPE::MOUSEMOVE == msg.Messtype)
	{
		auto pPickEntity = calculationPickEntity((float)msg.point.x, (float)msg.point.y);
		if (nullptr != pPickEntity)
		{
			mpPickActor = dynamic_cast<mini::CActor*>(pPickEntity);
			if (nullptr != mpPickActor)
			{
				mpPickActor->showBoundBox();
			}
		}
		else
		{
			if (nullptr != mpPickActor)
			{
				mpPickActor->hideBoundBox();
			}
		}
	}
}
